#!/sbin/openrc-run
supervisor=supervise-daemon

name="$RC_SVCNAME"

description="template rendering, notifier, and supervisor for HashiCorp Consul and Vault data"
description_reload="Reload configuration"

command=/usr/sbin/"$RC_SVCNAME"
command_args="$CONSUL_TEMPLATE_ARGS -config ${CONFIG:-/etc/$RC_SVCNAME/$RC_SVCNAME.hcl}"

depend() {
	after vault consul
}

reload() {
	ebegin "Reloading $RC_SVCNAME configuration"
	$supervisor "$RC_SVCNAME" --signal HUP
	eend $?
}
